﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

using LibraryBLL;
using LibraryBLL.BookBLL;

namespace WebAppLibrary.Json
{
    /// <summary>
    /// 获取所有图书类型
    /// </summary>
    public partial class GetAllBookType : System.Web.UI.Page
    {
        protected string strJson = string.Empty;
        BookTypeBLL ltb = new BookTypeBLL();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack == false)
            {
                try
                {
                    GetAllBookTypes();
                }
                catch (Exception ex)
                {
                    strJson = @"{success: false}";//失败
                    throw new Exception(ex.Message);
                }
            }
        }
        
        /// <summary>
        /// 获取所有图书类型信息
        /// </summary>
        private void GetAllBookTypes()
        {
            if (Request.Form["msg"] != null)
            {
                string message = Request.Form["msg"];
                strJson = ltb.GetAllBookType(message);
            }
            else
            {
                strJson = ltb.GetAllBookType("");
            }
        }
    }
}
